package util;

public class Pagination {
    private int totalNum=1;
    private int pageNo=1;
    private int pageSize=5;
    public String toLimitClause(int totalNum){
        this.totalNum = totalNum;
        int offset = (this.pageNo-1)*this.pageSize;
        return " Limit " + offset + "," + this.pageSize;
    }
    public Pagination(int pageSize, int pageNo){
        if (pageSize>0) {
            this.pageSize = pageSize;
        }
        if (pageNo>0) {
            this.pageNo = pageNo;
        }
    }
    public int getPageSize(){
        return pageSize;
    }
    public int getPageNo(){
        return pageNo;
    }
    public int getTotalNum(){
        return totalNum;
    }
}
